package com.hiwhitley.easy.day13;

import com.hiwhitley.base.TreeNode;

/**
 * Created by hiwhitley on 2016/8/17.
 */
public class IsSymmetric {
    public boolean isSymmetric(TreeNode root){
        return (root==null)?true:helper(root.left,root.right);
    }
    private boolean helper(TreeNode p,TreeNode q){
        return (p==null||q==null)?p==q:(p.val==q.val)&&helper(p.right,q.left)&&helper(p.left,q.right);
    }
}
